<%@ page import="java.sql.DriverManager" %>
<%@ page import="java.sql.Connection" %>
<%@ page import="java.sql.Statement" %><%--
  Created by IntelliJ IDEA.
  User: HiWin10
  Date: 2018/4/7 0007
  Time: 上午 11:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>更新用户操作</title>
</head>
<body>
<p>更新成功！</p>
<%

    String id = request.getParameter("id");
    String username = request.getParameter("username");
    String password = request.getParameter("password");

    // 3 +1
    Connection connection = null;
    Statement statement = null;

    // t_users(id, username, password) id自动增加

    String sql = "update t_users SET username " +
            "= '" + username + "', password='" + password +
            "' WHERE  id = " + id;//得到的就是输入的么？

    Class.forName("com.mysql.jdbc.Driver");

    connection= DriverManager.getConnection(
            "jdbc:mysql://localhost:3306/sctu_javaweb_2018?serverTimezone=UTC",
            "root",
            "123456"
    );

    statement = connection.createStatement();

    statement.execute(sql);

    statement.close();
    connection.close();
%>
</body>
</html>
